#include "keybutton.h"
#include <QKeyEvent>
#include <QtGui>

KeyButton::KeyButton(QWidget *parent) :
    QPushButton("SPACE",parent)
{
}

void KeyButton::mouseReleaseEvent ( QMouseEvent * e ){
    setText("Press a key...");
}

void KeyButton::mousePressEvent ( QMouseEvent * e ){
    setDown(true);
    setText("Press a key...");
}

void KeyButton::keyPressEvent(QKeyEvent *e){
    if(isDown()){

        m_key = e->nativeVirtualKey();
        setText(QString::number(m_key));
        setDown(false);
    }

}
